﻿using System;
using System.Web;

namespace Gonte
{
    public static class PathMapper
    {
        /// <summary>
        /// Maps a virtual path to the operating system one
        /// </summary>
        /// <param name="path">Virtual path to be mapped</param>
        /// <returns>The operating system path</returns>
        public static string MapPath(string path)
        {
            HttpContext context = HttpContext.Current;
            if (context != null) // It is a web application
            {
                return context.Server.MapPath(path);
            }

            return path;
        }
    }
}
